// 当前这个模块：API接口进行统一管理
import myrequest from './request';
import mockrequest from './mockrequest'

// 三级联动接口
// api/product/getBaseCatedgoryList()


// 发起请求：axios发请求返回结果Promise对象
export const reqCategory = () => {
    return myrequest({ method: 'get', url: '/product/getBaseCategoryList' });
}
export const reqBannerList = () => {
    return mockrequest({ method: 'get', url: '/banner' });
}
export const reqFloorList = () => {
    return mockrequest({ method: 'get', url: '/floor' });
}
// 搜索模块的接口
export const reqGetSearchInfo = (params) => myrequest({
    url: '/list',
    method: 'post',
    data: params
});
// 商品详情的接口
export const reqGetGoodsInfo = (skuId) => myrequest({
    url: `/item/${skuId}`,
    method: 'get',
});
export const reqAddOrUpdateShopCart = (skuId, skuNum) => myrequest({
    url: `/cart/addToCart/${skuId}/${skuNum}`,
    method: 'post',
});
//获取用户购物车的数据接口
export const reqShopCart = () => myrequest({
    url: '/cart/cartList',
    method: 'get'
});
// 删除购物产品的接口
export const reqDeleteCartById = (skuId) => myrequest({
    url: `/cart/deleteCart/${skuId}`,
    method: 'delete',
})
// 修改商品的选中状态
export const reqUpdataCheckedById = (skuId, isChecked) => myrequest({
    url: `/cart/checkCart/${skuId}/${isChecked}`,
    method: 'get',
})
//获取验证码
export const reqGetCode = (phone) => myrequest({
    url: `/user/passport/sendCode/${phone}`,
    method: 'get',
})
//用户注册
export const reqUserRegister = (data) => myrequest({
    url: `/user/passport/register/`, data,
    method: 'post',
})
// 用户登录
export const reqUserLogin = (data) => myrequest({
    url: `/user/passport/login`, data,
    method: 'post',
})
//获取用户登录成功以后用户信息的接口
export const reqUserInfo = () => myrequest({
    url: `/user/passport/auth/getUserInfo`,
    method: 'get'
});
//退出登录业务
export const reqUserLogout = () => myrequest({
    url: `/user/passport/logout`,
    method: 'get'
});
//获取用户地址信息
export const reqAddressInfo = () => myrequest({
    url: `/user/userAddress/auth/findUserAddressList`,
    method: 'get'
})
// 获取商品的清单
export const reqOrderInfo = () => myrequest({
    url: `/order/auth/trade`,
    method: 'get',
})
export const reqSubmitOrder = (tradeNo, data) => myrequest({
    url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
    data,
    method: 'post'
})
export const reqPayInfo = (orderId) => myrequest({
    url: `/payment/weixin/createNative/${orderId}`,
    method: 'get',
})
// 获取支付订单状态
export const reqPayStatus=(orderId)=>myrequest({
    url:`/payment/weixin/queryPayStatus/${orderId}`,
    method:'get',
})
//获取我的订单
export const reqMyOrderList = (page,limit)=>myrequest({
    url:`/order/auth/${page}/${limit}`,
    method:'get'
});